/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.expert.entity.Parameter;

/**
 * 参数DAO接口
 * @author lvbo
 * @version 2013-06-05
 */
public interface ParameterDao extends ParameterDaoCustom, CrudRepository<Parameter, Long> {

	@Query("from Parameter where name=?1 order by ID")
	public List<Parameter> uniqueName(String name);
	
	@Query("from Parameter where CATEGORY_ID = ?1")
	public List<Parameter> getList(Long category_id);
	
	@Query("select sum(weight) from Parameter where id in ?1")
	public long getSumWeightByIds(List<Long> ids);
}

/**
 * DAO自定义接口
 * @author lvbo
 */
interface ParameterDaoCustom extends BaseDao<Parameter> {

}

/**
 * DAO自定义接口实现
 * @author lvbo
 */
@Component
class ParameterDaoImpl extends BaseDaoImpl<Parameter> implements ParameterDaoCustom {
}
